//
//  TestViewController.m
//  PythonTestDemo
//
//  Created by 九月 on 12/24/24.
//

#import "TestViewController.h"

#import "PTUser.h"
#import "TestViewController+Add.h"
#import "TTotheMatchUserView.h"

@interface TestViewController ()

@property (strong, nonatomic) PTUser *mUser;

@end

@implementation TestViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self categoryMethod];
    
    [PTUser share].name = @"真麻烦";
    PTUser.share.age = 18;
    
    self.testUser.name = @"搞笑吗";
    self.testUser.age = 200;
    
    _testUser.age = 200;
    
    _mUser.name = @"哈哈";
    __weak typeof(self) fyweakSelf = self;
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        fyweakSelf.testUser.age = 200;
    });
    
    
    TTotheMatchUserView *ttathe = [TTotheMatchUserView ttotheMatchUserViewActionWith:self.view block:^(NSString * _Nonnull ttothe) {
        
    }];
    ttathe.ttotheUser = _testUser;
}

- (PTUser *)createUserWith1:(NSString *)name  {
    PTUser *user = [PTUser new];
    [user eatSome];
    user.name = @"九月";
    user.age = 18;
    [user setHeight:180.0];
    user.isBoy = YES;
    return user;
}

- (PTUser *)createUserWith2:(NSString *)name1 andAge:(NSInteger)age {
    PTUser *user = [[PTUser alloc] init];

    NSString *tempName = name1;
    if (tempName.length>0) {
        user.name = tempName;
    }
    
    
    user.age = age;
    CGFloat height = 150.0f;
    if (height>160) {
        [user setHeight:height];
    }
    else {
        [user setHeight:180.0f];
    }
    
    [self testWith:tempName height:height];
    
    user.isBoy = YES;
    
    PTUser *friend1 = [[PTUser alloc] init];
    
    NSString *name = @"小强";
    friend1.name = name;
    friend1.age = 20;
    [friend1 setHeight:170];
    friend1.isBoy = YES;
    
    user.friends = @[friend1];
    
    [user whoEatSome:@"九月" eatNorthing:@"汉堡包"];
    
    return user;
}

- (void)test {
    PTUser *user = [[PTUser alloc] init];
    user.name = @"九月";
    [user setHeight:180.0];
    user.isBoy = YES;
}

- (void)testWith:(NSString *)name height:(CGFloat)height {
    PTUser *user = [PTUser modelWithName:@"还好"];
    user.name = name;
    [user setHeight:height];
    user.isBoy = YES;
}


- (void)testDemo {
    NSString *name = @"小明";
    CGFloat height = 10;
    if (name.length>0) {
        NSLog(@"dfdsf = %@", name);
    }
    [self testWith:name height:height];
}

- (void)setTestUser:(PTUser *)testUser {
    _testUser = testUser;
    
    NSString *name = testUser.name;
    NSLog(@"name = %@", name);
}

- (PTUser *)testGetUser {
    if (!_testGetUser) {
        _testGetUser = [[PTUser alloc] init];
    }
    return _testGetUser;
}

- (void)trstModel:(PTUser *)user {
    user.name = @"哈比";
}


@end


@implementation TestItemView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.testImgView = [UIImageView new];
        
        self.testUser1 = [PTUser share];
        self.testUser1.name = @"";
    }
    return self;
}

- (UIImageView *)testImgView {
    if (!_testImgView) {
        _testImgView  = [[UIImageView alloc] init];
    }
    return _testImgView;
}

@end
